package com.xbongbong.saas.enums.business;

import com.xbongbong.i18n.util.I18nMessageUtil;
import lombok.Getter;

import java.util.Objects;

/***
 * 精线索套餐类型
 *
 * @author hongxiao
 * @date 2022-01-08 16:58
 * @since
 * @version
 */
@Getter
public enum FineCluePackageEnum {
    /**
     * 精线索套餐版本枚举
     */
    BUSINESS_TRIAL(0,"businessTrial", "enum.fineCluePackage.memo.business_trial"),
    BUSINESS(1, "business", "enum.fineCluePackage.memo.business"),
    FINE_CLUE_TRIAL(0, "fineClueTrial", "enum.fineCluePackage.memo.fine_clue_trial"),
    FINE_CLUE_STANDARD(10001, "fineClue", "enum.fineCluePackage.memo.fine_clue_standard"),
    FINE_CLUE_ADVANCED(10002, "fineClue", "enum.fineCluePackage.memo.fine_clue_advanced"),
    FINE_CLUE_DELUXE(10003, "fineClue", "enum.fineCluePackage.memo.fine_clue_deluxe"),
    ;
    /**
     * 购买类型
     */
    private Integer numType;
    /**
     * 搜客或工商查询alias
     */
    private String alias;
    /**
     * 描述
     */
    private String memo;

    FineCluePackageEnum(Integer numType, String alias, String memo) {
        this.numType = numType;
        this.alias = alias;
        this.memo = memo;
    }

    /**
     * 工商查询＋搜客试用没有对应的numType，调用时请注意
     *
     * @param numType
     * @return
     */
    public static FineCluePackageEnum getFineClueByNumType(Integer numType) {
        for (FineCluePackageEnum fineCluePackageEnum : values()) {
            if (Objects.equals(fineCluePackageEnum.getNumType(), numType)) {
                return fineCluePackageEnum;
            }
        }
        return null;
    }

    public String getMemo() {
        return I18nMessageUtil.getMessage(memo);
    }

}
